<?php
$colname_order_payment_by_id = "-1";
if (isset($_GET['order_id'])) {
  $colname_order_payment_by_id = $_GET['order_id'];
}
mysql_select_db($database_drycleaners_conn, $drycleaners_conn);
$query_order_payment_by_id = sprintf("SELECT person.first_name,
       person.last_name,
       `order`.created_date,
       `order`.id,
       branch.name,
       `order`.order_no
  FROM    (   (   drycleaners.`order` `order`
               INNER JOIN
                  drycleaners.branch branch
               ON (`order`.branch_id = branch.id))
           INNER JOIN
              drycleaners.customer customer
           ON (`order`.customer_id = customer.id))
       INNER JOIN
          drycleaners.person person
       ON (customer.person_id = person.id)
	   
		  WHERE order.branch_id='".$_SESSION['branch_id']."'
		  AND order.id = %s", GetSQLValueString($colname_order_payment_by_id, "int"));
$order_payment_by_id = mysql_query($query_order_payment_by_id, $drycleaners_conn) or die(mysql_error());
$row_order_payment_by_id = mysql_fetch_assoc($order_payment_by_id);
$totalRows_order_payment_by_id = mysql_num_rows($order_payment_by_id);
 get_main_menu("receptionist") ?>
<?php
mysql_select_db($database_drycleaners_conn, $drycleaners_conn);
$query_get_order_item = "
SELECT order_payment.id,order_payment.amount, order_payment.created_date, branch.name
  FROM    drycleaners.order_payment order_payment
       INNER JOIN
          drycleaners.branch branch
       ON (order_payment.branch_id = branch.id)
Where order_payment.order_id='".$_REQUEST['order_id']."'
";
$get_order_item = mysql_query($query_get_order_item, $drycleaners_conn) or die(mysql_error());
$row_get_order_item = mysql_fetch_assoc($get_order_item);
$totalRows_get_order_item = mysql_num_rows($get_order_item);
?>
<?php include"includes/table_settings.php"?>
  <div>
  <a href=".?<?php echo $_REQUEST['back_page']?>"><img src="images/back-button.png" width="30" height="30" title="Back" /></a><a href=".?order_installment_payment_add&action=Add&order_id=<?php echo $_REQUEST["order_id"]?>">
  <img src="images/add-button.jpg" width="30" height="30" title="Add <?php echo $object_name ?>" /></a></div> 
  
  <div class="module_title"><strong>Payment Installments Made For Order No:</strong><?php echo $row_order_payment_by_id['order_no'] ?>&nbsp;&nbsp;Of &nbsp; <strong>Customer Names:</strong><?php echo $row_order_payment_by_id['first_name']." ".$row_order_payment_by_id['last_name'] ?>
  </div> 
            	<table cellpadding="0" cellspacing="0" border="0" id="dataTable">
                <thead>
                  <tr>
                    <th>Id</th>
                    <th>Branch</th>
                    <th>Amount (Shs)</th>
                    <th>Date</th>
                    <th></th>
                    <th></th>
                  </tr>
                </thead>
                <tbody>
                 <!--Loop start, you could use a repeat region here-->
  <?php do{?>
    <!--Loop start, you could use a repeat region here-->
    <tr>
      <td><?php echo $row_get_order_item['id']?></td>
      <td><?php echo $row_get_order_item['name']?></td>
      <td><?php echo $row_get_order_item['amount']?></td>
      <td><?php echo date("d-Y-M",strtotime($row_get_order_item['created_date']))?></td>
      <td><a href=".?order_item= &amp;order_item_edit= true&amp;id=<?php echo $row_get_order_item['id']; ?>&amp;order_id=<?php echo $_REQUEST["order_id"] ?>&action=Edit"><input name='' value='Edit' type='button' id='edit_forms'/></a></td>
      <td><a href=".?order_item_delete&id=<?php echo $row_get_order_item['id']; ?>"><input name='' value='Delete' type='button' id='delete_forms'/></a></td>
    </tr>
    <?php }while($row_get_order_item=mysql_fetch_assoc($get_order_item));?>
                  <!--Loop end-->
                </tbody>
              </table>
        	</div>
<div class="tab_column" id="form_area">
          </div>         
     	</div>     
</div>
<?php
mysql_free_result($get_order_item);

mysql_free_result($order_payment_by_id);

mysql_free_result($payment_by_id);
?>